﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace CoCaNgua
{
    public class Game
    {
        private Player _turn;

        internal Player Turn
        {
            get { return _turn; }
            set { _turn = value; }
        }

        private Player[] _players;

        internal Player[] Players
        {
            get { return _players; }
            set { _players = value; }
        }
        private Dice _myDice;

        public Dice MyDice
        {
            get { return _myDice; }
            set { _myDice = value; }
        }
                
        public Game(Image imgDice, int playersnum)
        {
            MyDice = new Dice(imgDice);
            Players = new Player[playersnum];
            Players[0] = new Player(Color.Green);
            Players[1] = new Player(Color.Red);
            Players[2] = new Player(Color.Blue);
            Players[3] = new Player(Color.Yellow);

            this.Turn = Players[0];
        }

        public void NewGame(){
            for (int i = 0; i < 4; i++)
                for (int j = 0; j < 4; j++)
                {
                    Players[i].Knights[j].CurrentPos = 0;
                    Players[i].Knights[j].Invalidate();
                }

            MyDice.Value = 1;
            MyDice.Invalidate();
        }
    }
}
